package com.ttai.presenter.activity;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import com.google.gson.JsonObject;
import com.ttai.golbal.MyApplication;
import com.ttai.model.dao.DBHelper;
import com.ttai.model.net.ResponseInfo;
import com.ttai.presenter.base.BasePresenter;
import com.ttai.ui.activity.EnterPage;

import retrofit2.Call;

import static android.support.constraint.Constraints.TAG;

public class SRPThreePresenter extends BasePresenter {


    String ckey;
    @Override
    protected void showError(String message) {

    }

    @Override
    protected void parseJson(JsonObject json) {
        Log.i(TAG, "parseJson: srp验证成功");
        insertCkey(ckey);

    }
    public void srpThree(String response,String phone){
        Call<ResponseInfo> srpthree = responseInfoApi.srpthree(response, phone);
        srpthree.enqueue(new CallBackAdapter());
    }
    public void getCkey(String ckey){
        this.ckey = ckey;
    }
    private void insertCkey(String ckey) {
        DBHelper dbHelper = DBHelper.getInstance(MyApplication.getContext());
        SQLiteDatabase db=dbHelper.getWritableDatabase();
        ContentValues values=new ContentValues();
        values.put("ckey",ckey);
        db.update("ckeyacount",values, null, null);
    }
}
